<template>
  <div class="travel-story">
    <div class="story-box">
      <ul>
        <li v-for="item in list" :key="item.story_id">
          <h3>{{ item.title }}</h3>
          <!-- <p v-for="(contItem,index) in item.content" :key="index">
            {{ contItem }}
          </p> -->

          <p>
            {{item.content}}
          </p>
          <div class="stroy-control">
            <span class="show">展开&or;</span>
            <span class="hode">收起&and;</span>
          </div>
        </li>
      </ul>

    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: []
    }
  },
  created() {
    this.getStoData()
  },
  methods: {
    getStoData() {
      this.$axios
        .get('/data/story.json')
        .then((response) => {
          let { status, data } = response
          if (+status !== 200) return
          this.list = data
        })
        .catch((error) => {
          console.log(error)
        })
    }
  }
}
</script>

<style scoped>
.story-box {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0px 10px;
  background: #fff;
  box-shadow: 2px 2px 3px #eeeeee;
}
.story-box ul li {
  position: relative;
  padding-bottom: 20px;
  border-bottom: 2px dashed #dadada;
}
.story-box ul li h3 {
  font-size: 20px;
  color: brown;
  padding: 15px 0;
}
.story-box ul li p {
  color: #666;
  text-indent: 2em;
  line-height: 26px;
}
.story-box ul li .stroy-control {
  position: absolute;
  right: 0;
  bottom: 5px;
  color: brown;
  cursor: pointer;
}
.story-box ul li .stroy-control .hode {
  display: none;
}

/* 移动端样式 */
@media screen and (max-width: 767px) {
  .story-box {
    margin-top: 0;
    padding-top: 10px;
  }
  .story-box > ul li h3 {
    font-size: 13rem;
    padding: 1vw 0;
  }
  .story-box > ul li p {
    font-size: 11rem;
    line-height: 5vw;
  }
  .story-box ul li .stroy-control {
    font-size: 10rem;
  }
}
</style>